
const db = uniCloud.database();

exports.main = async (event, context) => {
  const { appointId } = event;

  if (!appointId) {
    return { code: 1, msg: '缺少预约ID' };
  }

  // 更新数据库中对应预约记录的 request_help 字段为 true
  await db.collection('appoint_schedule').doc(appointId).update({
    request_help: true,
  });

  return {
    code: 0,
    msg: '求助请求已提交'
  };
};
